home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.std.c,comp.lang.c.moderated
- Subject: Re: printf() format extensions - looking for beta testers...
- Date: 12 Apr 1996 07:30:15 -0500
- Organization: Carelcomp Products
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4klicn$ndl@solutions.solon.com>
- References: <4kgljv$l2p@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Peter Seebach wrote:
- >
- >
- > The basic idea of the proposed feature is that users would be able to install
- > new formats; for instance, the user would
- > do something like
- > int bangcvt(va_list *ap, char *s, int len, fmtspec *f) {
- > strncpy(s, strerror(errno), len);
- > s[len - 1] = '\0';
- > return strlen(s);
- > }
- >
- > main() {
- > format('!', bangcvt);
- >
- > /* do something which can generate an error */
- > fprintf(stderr, "%s: %!\n", "open failed");
- > }
-
- Given the above, how about calls like (well, not a pretty one, but you get the
- idea...):
-
- fprintf(stderr, "%-*.2!", something);
-
- Later,
- AriL
- --
- All my opinions are mine and mine alone.
-